#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

#include <zip.h>
#include <spdlog/spdlog.h>
#include <QTextBrowser>
#include <QFile>
#include <QTextStream>
#include <QListView>
#include <QStringListModel>
#include <QStandardItemModel>
#include <QStandardItem>
#include <QRegularExpression>
#include <QCompleter>
#include <QKeyEvent>
#include "codeeditor.h"

extern bool showDebug;
extern bool showTime;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void displayLogsFromZip(const QString &zipFilePath);

    static void displayLogsInTextBrowser(QPlainTextEdit *textBrowser, const QByteArray &logData);
private:
    void SetListVIew();

    void GetSeams();
private:
    QMap<QString,QByteArray> LogBuffer;
    QStringListModel *model;
    QStringListModel *lianxiang;
private slots:
    void on_pb_OpenZip_clicked();

    void on_listView_activated(const QModelIndex &index);

    void on_pb_compress_clicked();

    void on_pb_showDebug_clicked(bool checked);
    void on_tb_search_clicked();
    void on_pb_showTime_clicked(bool checked);

protected:
    void keyPressEvent(QKeyEvent *event) override;
private:
    Ui::MainWindow *ui;
    QCompleter *completer;
    QMap<QString,QString> KeyTID;
    QByteArray currentDisBuffer;

    CodeEditor *textBrowser;
};
#endif // MAINWINDOW_H
